package com.example;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@EnableEurekaClient
public class TracebackendApplication {
	private static final Logger LOG = Logger.getLogger(TracebackendApplication.class.getName());

	public static void main(String[] args) {
		SpringApplication.run(TracebackendApplication.class, args);
	}

	@GetMapping("/home")
	public String home() {
		LOG.log(Level.INFO, "trace demo backend is being called");
		return "Hello World." + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS").format(new Date());
	}

	@RequestMapping("/home2/{name}")
	public String callHome2(@PathVariable String name) {
		LOG.log(Level.INFO, "trace demo backend is being called");
		return "Hello World." + name;
	}
}
